package io.renren.modules.echarts.ResVo;

import io.renren.modules.echarts.entity.PieEntity;
import lombok.Data;

import java.util.List;
import java.util.stream.Collectors;

@Data
public class PieVo {
    private String name;
    private int value;

    public static PieVo build(PieEntity entity){
        PieVo pieVo = new PieVo();
        pieVo.setName(entity.getName());
        pieVo.setValue(entity.getValue());
        return pieVo;
    }

    public static List<PieVo> build(List<PieEntity> entities){
        return entities.stream().map(PieVo::build).collect(Collectors.toList());
    }
}
